<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
<%@include file="/manager/common/taglibs.jsp"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link href="">
<title>资产列表</title>
<link href="../css/css_manager.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="js/jquery-1.4.4.js"></script>
<script type="text/javascript" src="js/jquery.dialog.js"></script>

<script type="text/javascript">

	var  filmID = '${requestScope.filmID }';

	function deleteAsset(id){

		if(window.confirm("确认删除？")){
			window.location.href = "${ctx }/manager/assetAction!delete.do?id="+id;
		}
	}
	
	function modifyAsset(id){

		window.location.href = "${ctx }/manager/assetAction!modifyPrepare.do?id="+id;
	}

	function addPrepare(){
		window.location.href = "${ctx }/manager/assetAction!addPrepare.do?filmID="+filmID;
	}

	function jumptoChannelList(){

		var channelselect_value = document.getElementById("channelselect").value;
		window.location.href = "${ctx }/manager/filmAction!list.do?channelSelect="+channelselect_value;
	}
	function showlog(){
		var dialogBox1 = new Dialog("<form action=''><div id='getexceln'></div><input type='file' id='filePath' /><input type='button' onclick='gfp()' value='导入'/><form>",{
            "width":"600px",
            "title":"EXCEL导入",
            "modal":true,
            "closeModal":false
        });
	}
	
	function gfp(){
		//alert(document.getElementById("fil").value)
		var images=new Array();
		var xls=new ActiveXObject("Excel.application"); 
		var str="";
		nameAid="";
		var oWB = xls.Workbooks.open(document.getElementById("filePath").value);
		var oSheet = oWB.ActiveSheet;
		//alert(oSheet.usedRange.Rows.Count);
		//alert(oSheet.usedRange.Columns.Count);
		var excelrows=oSheet.usedRange.Rows.Count;
		var cell=new Array();
		for(var i=1;i<=excelrows;i++){
		cell[i-1]=new Array();
			for(var j=1;j<=2;j++){
			//str+=oSheet.Cells(i,j).value+"";
			cell[i-1][j-1]=oSheet.Cells(i,j).value+"";
			nameAid+=oSheet.Cells(i,j).value+"/r";
			}
			nameAid+="/n";
		}
		oWB.close();
		xls.Application.Quit(); 
		str+="<table border=1 cellspacing=0><tr><td>名称</td><td>视频ID</td><td>操作</td></tr>";
		for(var i=1;i<cell.length;i++){
		str+="<tr>";//str=str+"内容";
			for(var j=0;j<cell[0].length;j++){
				str+="<td>"+cell[i][j]+"&nbsp;</td>";
			}
			str+="<td>删除</td></tr>";
		}
		
		str+="<tr><td>&nbsp;</td><td><form action='${ctx }/manager/assetAction!savemore.do'><input type='button' value='保存' onclick='asset_link()'/></form></td><td>&nbsp;</td></tr></table>";
		document.getElementById("getexceln").innerHTML=str;
	}
	function asset_link(){
		window.location.href ="${ctx }/manager/assetAction!savemore.do?assets="+nameAid+"&asset.id=0&asset.filmid=${requestScope.cur_film.id }";
	}

</script>
<style type="text/css">
*{margin:0; padding:0; list-style: none;}
img{border:0;}
body{font-size:12px; font-family:Tahoma,Arial,Verdana,Helvetica,sans-serif; color:#353535; }
/* 弹出层 */
.dialog-box{ position: absolute; z-index:1001}
.dialog-popup{/*background-color:#333333\9;*/filter:progid:DXImageTransform.Microsoft.gradient(enabled='true',startColorstr='#7F333333', endColorstr='#7F333333'); position:relative;z-index:29; zoom:1;background:rgba(51,51,51,0.5);  padding: 10px;}
.dialog-popup .dialog-title-bar{ height:30px; background-color:#CDCDCD; position:relative;}
.dialog-popup .dialog-title-bar h2{ line-height:30px; padding-left:10px; font-size:14px; font-weight:700}
.dialog-popup .dialog-title-bar a.close-dialog{ position:absolute;top:5px; right:10px; background-color:#FFFFFF; border:1px solid #FF3300; font-size:14px; font-weight:700; display:block; height:18px; width:18px; line-height:18px;}
.dialog-popup .dialog-title-bar a.close-dialog{text-decoration:none; color:#555555; text-align:center;}
.dialog-popup .dialog-title-bar a.close-dialog:hover{text-decoration:none; color:#333333}
.dialog-content{ background-color:#FFFFFF; padding:10px}
.dialog-iframe-mask{position:absolute; left:0; top:0; border: none;}
.boxy-modal-blackout{position:absolute; left:0; top:0; border: none; background-color:#333333; overflow:hidden; z-index:999}
</style>
</head>

<body>

<jsp:include page="/manager/common/head.jsp"></jsp:include>

<div style="margin: 0 auto; width: 960px;margin-top: 50px;">
	<span style="padding-left: 20px;float: left;padding-bottom: 5px;font-size: 14px;">
		<h5>当前位置:${requestScope.cur_channel.name } &gt;&gt;  ${requestScope.cur_column.name }
		&nbsp;&nbsp;&nbsp;&nbsp;所属影片: ${requestScope.cur_film.name }</h5>
	</span>
	<span style="padding-right: 30px;float: right;padding-bottom: 5px;">
		<select id="channelselect" onchange="jumptoChannelList()">
			<option value="">---返回影片列表---</option>
			<option value="" >全部</option>
			<c:forEach items="${requestScope.channelList}" var="channel">
				 <option value="${channel.id}">${channel.name }</option>
			</c:forEach>
		</select>&nbsp;&nbsp;
		<a href="javascript:addPrepare()">添加视频内容</a>
		&nbsp;&nbsp;&nbsp;&nbsp;<a href="javascript:showlog()">批量导入视频</a>
	</span>
</div>

<table align="center" border="0" class="border_table" width="960">
	<tr><td colspan="100%" style="text-align: center;background-color: silver;" height="25">影片内容列表</td></tr>
	<tr>
		<td align="center" height="25">序号</td>
		<td align="center">名称</td>
		<td align="center">视频ID</td>
		<td align="center">操作</td>
	</tr>
	<c:forEach items="${requestScope.assetList}" var="asset" varStatus="status">
		<tr>
			<td align="center" height="25">${status.count }</td>
			<td align="center">${asset.name }</td>
			<td align="center">${asset.fileId}</td>
			<td align="center">
				<a href="javascript:deleteAsset(${asset.id })">删除</a>
				&nbsp;&nbsp;<a href="javascript:modifyAsset(${asset.id })">修改</a>
			</td>
		</tr>
	</c:forEach>
</table>

<jsp:include page="/manager/common/footer.jsp"></jsp:include>

</body>
</html>